package com.neu.wms.service.impl;

import com.neu.wms.dto.ShelfDto;
import com.neu.wms.entity.WmsShelf;
import com.neu.wms.mapper.WmsShelfMapper;
import com.neu.wms.service.ShelfService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class ShelfServiceImpl implements ShelfService {
    @Autowired
    WmsShelfMapper wmsShelfMapper;
    @Override
    public List<WmsShelf> selectAll(ShelfDto shelfDto) {
        return wmsShelfMapper.selectAll(shelfDto);
    }

    @Override
    public WmsShelf selectByPrimaryKey(Long id) {
        return wmsShelfMapper.selectByPrimaryKey(id);
    }

    @Override
    public int insert(WmsShelf wmsShelf) {
        wmsShelf.setDelFlag(0);
        return wmsShelfMapper.insert(wmsShelf);
    }

    @Override
    public int update(WmsShelf wmsShelf) {
        return wmsShelfMapper.updateByPrimaryKeySelective(wmsShelf);
    }

    @Override
    public int updateDelFlag(ShelfDto shelfDto) {
        return wmsShelfMapper.updateDelFlag(shelfDto);
    }

    @Override
    public int delete(Long id) {
        return wmsShelfMapper.deleteByPrimaryKey(id);
    }
}
